package com.feishi.core.socket.common;

import com.feishi.core.analytic.assembler.BaseAssembler;
import com.feishi.core.socket.common.lifecycle.SocketApplication;
import com.feishi.core.socket.common.lifecycle.SocketSession;

/**
 * Created by caixq on 5/15 015.
 */
public abstract class SocketClient <T extends BaseAssembler> {
    /*
     * 服务器端口号
     */
    public abstract int getPort();
    /*
     * 服务器IP
     */
    public abstract String getHost();
    public abstract void startConnect();
    protected SocketSession<T> session;

    protected SocketApplication<T> application=new SocketApplication<T>();

    public SocketApplication<T> getApplication() {
        return application;
    }

    public void setApplication(SocketApplication<T> application) {
        this.application = application;
    }

    public SocketSession<T> getSession() {
        return session;
    }

    public void setSession(SocketSession<T> session) {
        this.session = session;
    }

    public void write(byte[] bytes){
        session.getSocketHandler().write(bytes);
    };
}
